test: implement tests for application update functionality#2562
test: implement tests for application update functionality#2562iamitprakash merged 17 commits intodevelopfrom
Conversation
…ror handling - Added a new error message for editing applications too soon. - Implemented a function to build the update payload for applications. - Updated the application update logic to include user authorization and time-based restrictions. - Refactored the application validator to include comprehensive validation for update data. - Adjusted routes to use the new validation function for application updates.
- Added integration tests for the PATCH /applications/:applicationId endpoint, covering various scenarios including successful updates, validation errors, and authorization checks. - Enhanced unit tests for the applications controller to validate update logic and error handling. - Introduced validation tests for application update data to ensure proper request structure and content. - Updated application model tests to verify correct behavior for update operations under different conditions.
|
Important Review skippedAuto incremental reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the You can disable this status message by setting the Use the checkbox below for a quick retry:
WalkthroughThis PR adds comprehensive test coverage for the PATCH /applications/:applicationId endpoint across integration, controller, middleware, and model layers. Tests verify successful updates, authorization checks, ownership validation, 24-hour edit conflict detection, and field validation rules. Changes
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes Possibly related PRs
Suggested reviewers
Poem
🚥 Pre-merge checks | ✅ 3✅ Passed checks (3 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing touches🧪 Generate unit tests (beta)
Tip Issue Planner is now in beta. Read the docs and try it out! Share your feedback on Discord. Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
…ow a maximum of 168 hours
…in application update
|
@coderabbitai bro review, please go easy on @AnujChhikara |
|
Let me dive into the changes and provide helpful feedback. 🚀 ✅ Actions performedReview triggered.
|
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Fix all issues with AI agents
In `@test/integration/application.test.ts`:
- Around line 359-427: The tests mutate applicationId1 in the first "should
return 200..." case which sets lastEditAt and causes later PATCH validation
tests to get 409 Conflict; fix by isolating tests—either create a fresh
application for each PATCH test or switch the validation tests to use a
different pre-seeded app (e.g., applicationId2 with superUserJwt), update the
tests in the "PATCH /applications/:applicationId" describe block to use the new
application id or create a new application within each it() before sending the
PATCH so the 24-hour edit restriction does not interfere.
The base branch was changed.
…application test suite
… in application validation tests
Date: 30 Jan 2026
Developer Name: @AnujChhikara
Issue Ticket Number
Description
Documentation Updated?
Under Feature Flag
Database Changes
Breaking Changes
Development Tested?
Test Coverage
Screenshot 1